﻿using IntelligentAgriculture.Contracts.Interface.Iridgepletype;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.RidgepCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.RidgepCommandHandler
{
	/// <summary>
	/// 根据id获取栋舍
	/// </summary>
	public class GetRidgepolesCommandHandler : IRequestHandler<GetRidgepolesCommand, IQueryable<Ridgepole>>
	{
		private readonly IridegpoleService _iridegpoleService;

	    public GetRidgepolesCommandHandler(IridegpoleService iridegpoleService)
		{
			_iridegpoleService = iridegpoleService;
		}
		public async Task<IQueryable<Ridgepole>> Handle(GetRidgepolesCommand request, CancellationToken cancellationToken)
		{
			var list=await _iridegpoleService.GetRidgepoles(request.rig);
			return list.AsQueryable();
		}
	}
}
